package com.epoch.zuul.auth.controller;

import bean.response.ResponseBean;
import bean.response.ResultEnum;
import com.epoch.zuul.auth.service.CsRoleService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import utils.ResultInfoUtil;

import java.util.HashMap;

/**
 * @author admin
 */
@Slf4j
@RestController
public class CsRoleController {

    @Autowired
    private CsRoleService csRoleService;

    @RequiresAuthentication
    @ApiOperation(value = "用户版块")
    @RequestMapping(value = "epoch/csRole/getCsRole", method = RequestMethod.POST)
    public ResponseBean getRoleById(@RequestParam("csId") String csId){
        return ResultInfoUtil.buildSuccess(ResultEnum.OK,"根据csId成功获取该用户的角色",csRoleService.getRoleId(csId));
    }

    @RequiresAuthentication
    @ApiOperation(value = "用户版块")
    @PutMapping("epoch/csRole/updateCsRoleByCsIdRoleId")
    public ResponseBean updateCsRoleByCsIdRoleId(@RequestBody HashMap<String, String> map){
        return csRoleService.updateCsRoleByCsIdRoleId(map);
    }
}
